﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PurchaseReturn.aspx.cs" Inherits="Main_Inventory_PurchaseReturn" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Purchase Return</title>
    <link rel="Stylesheet" href="../../Styles/accounts.css" type="text/css" />
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    <%--<script src="../../Menu/js/jquery.min.js" type="text/javascript"></script> --%>
    <script src="../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>
     <script type="text/javascript" language="javascript">

         function GetQuantity(hidItemId, CtrlId, HidLocationId) {
             if (hidItemId != '' && parseFloat(hidItemId) > 0) {
                 var ctrlIndex = HidLocationId.toString();
                 var LocationIdandQty = document.getElementById(ctrlIndex).value;
                 window.open('WinSaleQty.aspx?ItemId=' + hidItemId + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty, '', 'width=700, height=400, resizable=0');
             }
             else {
                 alert('Choose Item First');
                 return false;
             }
         }
         
         function CalculateAmtBillLevel() {
             var Count = document.getElementById("hidControlBillLevel").value;
             var hidTranFormatType = document.getElementById("hidTranFormatType").value;
             var TotalQty = 0;
             var TotalAmount = 0;
             var TotalTax = 0;
             if (hidTranFormatType == 'False') {
                 for (var i = 1; i <= Count; i++) {
                     var Qty = document.getElementById("txtQuantityBillLevel" + i);
                     var RateAmt = document.getElementById("txtRateBillLevel" + i);
                     var TaxRate = document.getElementById("hidTaxRateBillLevel" + i);
                     var TaxAmount = document.getElementById("hidTaxAmtBillLevel" + i);
                     var ItemAmount = document.getElementById("txtTotalAmountBillLevel" + i);
                     var itemAmt = 0;
                     var taxAmt = 0;
                     if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                         TotalQty += parseFloat(Qty.value);
                         if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                             itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                             TotalAmount += parseFloat(itemAmt);

                             if (TaxRate.value != '' && parseFloat(TaxRate.value) > 0) {
                                 taxAmt = (parseFloat(itemAmt) * parseFloat(TaxRate.value)) / 100;
                             }
                             TotalTax += parseFloat(taxAmt);
                         }
                         document.getElementById("txtTotalAmountBillLevel" + i).value = parseFloat(itemAmt).toFixed(2);
                         document.getElementById("hidTaxAmtBillLevel" + i).value = parseFloat(taxAmt).toFixed(2);
                     }
                 }
             }
             else if (hidTranFormatType == 'True') {
                 for (var i = 1; i <= Count; i++) {
                     var Qty = document.getElementById("txtQuantityBillLevel" + i);
                     var RateAmt = document.getElementById("txtRateBillLevel" + i);
                     var TaxRate = document.getElementById("hidTaxRateBillLevel" + i);
                     var TaxAmount = document.getElementById("hidTaxAmtBillLevel" + i);
                     var ItemAmount = document.getElementById("txtTotalAmountBillLevel" + i);
                     var itemAmt = 0;
                     var taxAmt = 0;
                     var TotalItemAmt = 0;
                     if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                         TotalQty += parseFloat(Qty.value);
                         if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                             itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                             if (TaxRate.value != '' && parseFloat(TaxRate.value) > 0) {
                                 taxAmt = (parseFloat(itemAmt) * parseFloat(TaxRate.value)) / 100;
                             }
                             TotalTax += parseFloat(taxAmt);
                         }
                         TotalItemAmt = parseFloat(itemAmt) + parseFloat(taxAmt);
                         TotalAmount += parseFloat(TotalItemAmt);
                         document.getElementById("txtGrossAmtBillLevel" + i).value = parseFloat(itemAmt).toFixed(2);
                         document.getElementById("txtTaxAmountBillLevel" + i).value = parseFloat(taxAmt).toFixed(2);
                         document.getElementById("txtTotalAmountBillLevel" + i).value = parseFloat(TotalItemAmt).toFixed(2);
                     }
                 }
             }
             var grossTotal = TotalAmount + TotalTax;
             document.getElementById("txtTotalItemBillLevel").value = TotalQty.toFixed(2);
             document.getElementById("txtPreTaxBillLevel").value = TotalAmount.toFixed(2);
             document.getElementById("txtTaxableAmtBillLevel").value = TotalAmount.toFixed(2);
             document.getElementById("txtVatBillLevel").value = TotalTax.toFixed(2);
             document.getElementById("txtPostTaxBillLevel").value = grossTotal.toFixed(2);
             var roundOff = 0;
             roundOff = document.getElementById("txtRoundOffBillLevel").value;
             if (roundOff == '') {
                 roundOff = 0;
             }
             var GrandTotal = grossTotal + parseFloat(roundOff);
             document.getElementById("txtGrandTotalBillLevel").value = GrandTotal.toFixed(2);
         }
         
         function EnabledTabKey(id, e) {
             var keycode;
             if (window.event) {
                 keycode = window.event.keyCode;
             }
             else if (e) {
                 keycode = e.which;
             }
             else {
                 return true;
             }

             if (keycode == 9) {
                 // if is the tab key                
                 return true;
             }
             else {
                 return false;
             }
         }
        
         function ValidateItems() {
             var flag = true;
             var Count = document.getElementById("hidControlBillLevel").value;
             var hidTranFormatType = document.getElementById("hidTranFormatType").value;
             if (hidTranFormatType == 'False') {
                 for (var i = 1; i <= Count; i++) {
                     var Qty = document.getElementById("txtQuantityBillLevel" + i);
                     var RateAmt = document.getElementById("txtRateBillLevel" + i);
                     if (Qty.value == '' || Qty.value == '0') {
                         alert('Please Specify Return Quantity At Row No. ' + i);
                         document.getElementById("txtQuantityBillLevel" + i).focus();
                         flag = false;
                         return false;
                         break;
                     }
                     else if (RateAmt.value == '' || RateAmt.value == '0') {
                         alert('Please Specify Item Amount At Row No. ' + i);
                         document.getElementById("txtRateBillLevel" + i).focus();
                         flag = false;
                         return false;
                         break;
                     }
                 }
                 if (document.getElementById("ddlVatBillLevel").value == '0') {
                     alert('Please Specify Tax Type ');
                     document.getElementById("ddlVatBillLevel").focus();
                     flag = false;
                 }
                 else if (document.getElementById("ddlSaleLedger").value == '0') {
                     alert('Please Specify Sale Ledger');
                     document.getElementById("ddlSaleLedger").focus();
                     flag = false;
                 }
                 else if (document.getElementById("ddlSaleTaxLedger").value == '0') {
                     alert('Please Specify Sale Tax Ledger');
                     document.getElementById("ddlSaleTaxLedger").focus();
                     flag = false;
                 }
             }
             if (hidTranFormatType == 'True') {
                 for (var i = 1; i <= Count; i++) {
                     var Qty = document.getElementById("txtQuantityBillLevel" + i);
                     var RateAmt = document.getElementById("txtRateBillLevel" + i);
                     var DllTaxType = document.getElementById("ddlTaxType" + i);
                     var DdlSaleLedger = document.getElementById("ddlSaleLedger" + i);
                     var DllSaleTaxType = document.getElementById("ddlSaleTaxLedger" + i);
                     if (Qty.value == '' || Qty.value == '0') {
                         alert('Please Specify Return Quantity At Row No. ' + i);
                         document.getElementById("txtQuantityBillLevel" + i).focus();
                         flag = false;
                         break;
                     }
                     else if (RateAmt.value == '' || RateAmt.value == '0') {
                         alert('Please Specify Item Amount At Row No. ' + i);
                         document.getElementById("txtRateBillLevel" + i).focus();
                         flag = false;
                         break;
                     }
                     else if (DllTaxType.value == '0') {
                         alert('Please Specify Tax Type At Row No. ' + i);
                         document.getElementById("ddlTaxType" + i).focus();
                         flag = false;
                         break;
                     }
                     else if (DdlSaleLedger.value == '0') {
                         alert('Please Specify Sale Ledger At Row No. ' + i);
                         document.getElementById("ddlSaleLedger" + i).focus();
                         flag = false;
                         break;
                     }
                     else if (DllSaleTaxType.value == '0') {
                         alert('Please Specify Sale Tax At Row No. ' + i);
                         document.getElementById("ddlSaleTaxLedger" + i).focus();
                         flag = false;
                         break;
                     }
                 }
                 return flag;
             }
         }


         function ValidateMain() {
             var flag = true;
             if (document.getElementById("ddlFormat").value == '0') {
                 alert('Please Specify Transaction Format');
                 document.getElementById("ddlFormat").focus();
                 flag = false;
             }
             else if (document.getElementById("ddlSupplier").value == '0') {
                 alert('Please Specify Customer/Vender');
                 document.getElementById("ddlSupplier").focus();
                 flag = false;
             }
             else if (document.getElementById("txtVoucher").value == '') {
                 alert('Please Specify Voucher Number');
                 document.getElementById("txtVoucher").focus();
                 flag = false;
             }
             else if (document.getElementById("ddlTaxGroup").value == '0') {
                 alert('Please Specify Tax Group');
                 document.getElementById("ddlTaxGroup").focus();
                 flag = false;
             }
             else if (document.getElementById("txtDate").value == '' || document.getElementById("txtDate").value == '__/__/____') {
                 alert('Please Specify Transaction Date');
                 document.getElementById("txtDate").focus();
                 flag = false;
             }
             else if (document.getElementById("hidControlBillLevel").value == '0') {
                 alert('Please Specify Items For Sale Return');
                 flag = false;
             }
             return flag;
         }

         function Validation() {
             if (ValidateMain() && ValidateItems()) {
                 return true;
             }
             else {
                 return false;
             }

         }

         function OpenWindow() {
             var ddl = document.getElementById("ddlSupplier");
             var ddlValue = ddl.options[ddl.selectedIndex].value;
             var curDate = document.getElementById("txtDate").value;
             if (curDate == '') {
                 var currentTime = new Date()
                 var month = currentTime.getMonth() + 1
                 var day = currentTime.getDate()
                 var year = currentTime.getFullYear()
                 curDate = day + '/' + month + '/' + year;
             }
             if (parseFloat(ddlValue) > 0) {
                 window.open('PurchaseReturnItem.aspx?Lid=' + ddlValue + '&CurDate=' + curDate, '', 'resizeable=1, scrollbars=1,width=600, height=500');
             }
             else {
                 alert('Select Supplier first');
                 return false;
             }
         }

         function CreateEvent() {
             document.getElementById("btnCreateItem").click();
         }
     
     </script>
     
     <style type="text/css">   
    #wrapper {
        width:110%;
        margin-left:5%;
        margin-top:15px;
    }
    ul.tabs {
        width:99%;
        margin:0;
        padding:0;
    }
    ul.tabs li {
        display:block;
        float:left;
        padding:0 5px;
    }
    ul.tabs li a {
        display:block;
        float:left;
        padding:5px;
        font-size:0.8em;
        background-color:#e0e0e0;
        color:#666;
        text-decoration:none;
    }
    .selected {
        font-weight:bold;
    }
    .tab-content {
	    clear:both;
        border:1px solid #ddd;
        padding:10px;
    }
    .messageBox
    {
        text-decoration:none;        
        padding-left:7px;
        padding-right:7px;
        display:block;
        padding-top:3px;
        padding-bottom:3px;
        background-color:#61A737;
        text-align:center;
        color:White;
        font-weight:bold;
        width:55px;
    }
</style>
     
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"> </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="Purchase Return" />     
        <div class="divmain" style="width:90%; margin-left:5%; margin-right:5%; margin-top:20px;">
         
                   
         
                <div style="margin-left:5%; margin-right:5%; width:90%" align="center">
                        <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
                        <asp:HiddenField ID="hidCountReturnRow" runat="server" Value="0" />
                </div>
                  <asp:HiddenField ID="hidTranFormatType" runat="server"/>
                    <table class="tablecontent" style="width:100%">
                        <tr>
                            <td class="headtd" colspan="4">
                               Purchase Return
                           </td>
                        </tr>
                        <tr>
                            <td style="width:12%">
                                Bill Format<span style="color:Red">*</span>
                                <asp:HiddenField ID="hidTaxLevel"  runat="server" />
                            </td>
                            <td style="width:35%;">
                                <asp:DropDownList ID="ddlFormat" runat="server" Width="175px" CssClass="dropdown" OnSelectedIndexChanged="ddlFormat_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>                                
                            </td>
                            <td style="width:12%">
                                Supplier<span style="color:Red">*</span>
                            </td>
                            <td style="width:41%">
                                <asp:DropDownList ID="ddlSupplier" runat="server" Width="240px" CssClass="dropdown" AutoPostBack="true"
                                OnSelectedIndexChanged="ddlSupplier_OnSelectedIndexChanged"
                                ></asp:DropDownList>                               
                            </td>
                         </tr>
                        <tr >
                            <td>
                                Voucher No.<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtPrefix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="prefixWater" runat="server" TargetControlID="txtPrefix" WatermarkText="Prefix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                <asp:TextBox ID="txtVoucher" runat="server" Width="70px" CssClass="inputnumber" ValidationGroup="V" MaxLength="10" ></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="voucherWater" runat="server" TargetControlID="txtVoucher" WatermarkText="Number" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>                            
                                <asp:TextBox ID="txtSuffix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="suffixWater" runat="server" TargetControlID="txtSuffix" WatermarkText="Suffix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                            </td>                            
                            <td >
                                Tax Group<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:DropDownList ID="ddlTaxGroup" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTaxGroup_OnSelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                           
                            </td>
                        </tr>
                        <tr >
                            <td >
                                Date<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtDate" runat="server" Width="120px" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                                <AjaxControl:CalendarExtender ID="cal" runat="server" PopupButtonID="btnDate" TargetControlID="txtDate" Format="dd/MM/yyyy"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskExt" runat="server" MaskType="Date" Mask="99/99/9999" TargetControlID="txtDate" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValid" runat="server" ControlExtender="maskExt" InvalidValueMessage="Invalid Date" IsValidEmpty="true" Display="Dynamic" ValidationGroup="V" ControlToValidate="txtDate"></AjaxControl:MaskedEditValidator>                             
                              
                            </td>
                            <td >
                               Cash/Credit                             
                            </td>
                            <td>
                                <div style="float:left"> 
                                    <asp:RadioButtonList ID="rbtCashCredit" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Text="Cash" Value="0" Selected="True"></asp:ListItem>
                                        <asp:ListItem Text="Credit" Value="1"></asp:ListItem>
                                    </asp:RadioButtonList>
                                </div> 
                                <div style="float:left"> 
                                    &nbsp;<asp:TextBox ID="txtCreditDay" runat="server" onKeyPress="return isNumberKey(this.id,event)" Width="60px" CssClass="inputnumber" MaxLength="3"></asp:TextBox>&nbsp;Days                                                           
                                </div>
                                <div style="clear:both"></div>
                            </td>
                        </tr>
                        <tr>
                            <td> Price Group</td>
                            <td> <asp:DropDownList ID="DdlPriceGroup" runat="server"></asp:DropDownList> </td>
                            <td>
                                Bill Ref: <span style="color:Red">*</span> 
                            </td>
                            <td>
                                <asp:TextBox ID="txtBillRef1" runat="server" Width="90px" CssClass="input" ValidationGroup="V" MaxLength="20"></asp:TextBox>
                                <asp:TextBox ID="txtBillRef2" runat="server" Width="80px" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                <AjaxControl:CalendarExtender ID="extCalbill" runat="server" Format="dd/MM/yyyy" TargetControlID="txtBillRef2"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskRefDate" runat="server" Mask="99/99/9999" TargetControlID="txtBillRef2" MaskType="Date" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValidRef" runat="server" ControlExtender="maskRefDate" ControlToValidate="txtBillRef2" ValidationGroup="V" InvalidValueMessage="*"></AjaxControl:MaskedEditValidator>
                            </td>
                           
                        </tr>
                    </table>
            
                <asp:Panel ID="panelBillLevel"  runat="server">
                    <div id="wrapper">    
                        <ul class="tabs">
                            <li><a href="javascript:void(0)" class="defaulttab" rel="tabGeneralBillLevel">General</a></li>
                            <li><a href="javascript:void(0)" rel="tabOtherBillLevel">Other</a></li>                   
                        </ul> 
                    </div>
                        <div class="tab-content" id="tabGeneralBillLevel" runat="server">
                                      
                          
                                     <div style="width:100%">  
                                        <asp:HiddenField ID="hidControlBillLevel" Value="0" runat="server" />                 
                                        <table id="tblBillLevel" runat="server" style="width:100%" class="tablecontent" cellpadding="2" cellspacing="0">
                                            <%--    for bill level--%>
                                            <tr id="trBillLevel" runat="server" visible="false" >
                                                <td style ="width:25%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item(s)</td>
                                                <td style ="width:15%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Unit</td>
                                                <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Qty.</td>
                                                <td style ="width:10px; border-right:1px solid #818181; border-bottom:1px solid #818181;" class="headtd">&nbsp;</td>
                                                <td style ="width:20%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Rate</td>                          
                                                <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item Amt</td>                        
                                            </tr> 
                                               <%--  for Item level(with xtra field)  --%>
                                            <tr id="trItemLevel" runat="server" visible="false">
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item(s)</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Unit</td>
                                                <td style ="width:10%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Qty.</td>
                                                <td style ="width:10px; border-right:1px solid #818181; border-bottom:1px solid #818181;" class="headtd">&nbsp;</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Rate</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Gross Amt.</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax Amt</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item Amt</td>
                                                <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Sale Ledger</td>                                                                       
                                                <td style ="width:10%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax Ledger</td>                        
                                            </tr>             
                                        </table>

                                          <table style="width:98%; margin:5px;" align="right" >
                                                <tr>
                                                    <td> 
                                                        <asp:HyperLink ID="hyperOpenItem" runat="server" NavigateUrl="#" Text="Choose Items from Bill..." onclick="OpenWindow();"></asp:HyperLink>
                                                    </td>
                                                </tr>
                                          </table>
                                    </div>
                             

                            <div style="width:100%;">
                             
                                <div align="left" style="width:50%; float:left; " >
                                <asp:Panel ID="panelSaleBillLevel" runat="server">
                                            <table style="width:100%;" align="left">
                                                <tr>
                                                    <td style="width:30%">
                                                        Sales Ledger :
                                                    </td>
                                                     <td style="width:70%" align="left">
                                                        <asp:DropDownList ID="ddlSaleLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                                                    </td>
                                                </tr>
                                                 <tr>
                                                    <td style="width:30%">
                                                        Tax Ledger :
                                                    </td>
                                                     <td align="left" style="width:70%">
                                                        <asp:DropDownList ID="ddlSaleTaxLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                                                    </td>
                                                </tr>
                                            </table>
                                </asp:Panel>
                                </div>
                                <div style="width:50%; float:right">
                                 <table style="width:100%; text-align:left;">
                                    <tr>
                                        <td style="width:70%">
                                            Total Item
                                        </td>
                                        <td style="width:30%">
                                            <asp:TextBox ID="txtTotalItemBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Pre Tax Total
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtPreTaxBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Taxable Amount
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtTaxableAmtBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            VAT/CST &nbsp;<asp:DropDownList ID="ddlVatBillLevel" Width="150px" CssClass="dropdown" runat="server" OnSelectedIndexChanged="ddlVatBillLevel_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                                            <asp:HiddenField ID="hidTaxRateBillLevelMain" runat="server" />
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtVatBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Post Tax Total
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtPostTaxBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Round off Amount
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtRoundOffBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return isNumberKey(this.id,event)" AutoCompleteType="Disabled" Text="0.00" onblur="return roundOff();"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Grand Total
                                        </td>
                                        <td>
                                             <asp:TextBox ID="txtGrandTotalBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  AutoCompleteType="Disabled" ></asp:TextBox>
                                        </td>
                                    </tr>
                                 </table>
                                </div>
                            
                                <div style="clear:both"> </div>
                            </div>
                          
                        </div>
                        <div class="tab-content" id="tabOtherBillLevel" runat="server">
                                <div style="width:100%">
                                    
                                <div style="width:48%; float:left; margin-right:4%">
                                    <table align="left" style="width:100%">
                                        <tr>
                                            <td style="width:30%">
                                                Billing Address
                                            </td>
                                            <td style="width:70%">
                                                <asp:TextBox ID="txtBillAddress" runat="server" TextMode="MultiLine" CssClass="input" Width="97%" Height="60px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:30%">
                                                Delivery Address
                                            </td>
                                            <td style="width:70%">
                                                <asp:TextBox ID="txtDeliveryAdd" runat="server" TextMode="MultiLine" CssClass="input" Width="97%"  Height="60px"></asp:TextBox>
                                            </td>
                                        </tr>
                                    </table> 
                                 </div>
                                 <div style="width:48%; float:left;">
                                    <table align="right" style="width:100%">
                                        <tr>
                                            <td style="width:40%">
                                                Mode of Delivery
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtDeliveryMode" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Delivery Date
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtDeliveryDate" runat="server" Width="97%" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                                <AjaxControl:CalendarExtender ID="extCal2" runat="server" TargetControlID="txtDeliveryDate" Format="dd/MM/yyyy" ></AjaxControl:CalendarExtender>
                                                <AjaxControl:MaskedEditExtender ID="maskDeliveryDate" runat="server" TargetControlID="txtDeliveryDate" MaskType="Date" Mask="99/99/9999" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                                <AjaxControl:MaskedEditValidator ID="maskValidDelivery" InvalidValueMessage="Invalid Date" runat="server" ControlToValidate="txtDeliveryDate" ControlExtender="maskDeliveryDate" IsValidEmpty="true" ValidationGroup="V"></AjaxControl:MaskedEditValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Document NO.
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtDocumentNo" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Transporter Name
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtTransporter" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Vehicle Number
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtVehicle" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>                                   
                             
                                        <tr>
                                            <td style="width:40%">
                                                Prepared By
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtPreparedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Checked By
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtCheckedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Authorized Signatory
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtSignatory" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Narration
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtNarration" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:40%">
                                                Remarks
                                            </td>
                                            <td style="width:60%">
                                                <asp:TextBox ID="txtRemark" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                            </td>
                                        </tr> 
                                    </table>
                                 </div>
                                  
                                 <div style="clear:both"></div>
                                </div>
                        </div>
     
             <asp:LinkButton ID="lnkModal" runat="server"></asp:LinkButton>
            <asp:Panel ID="panelFormatMessage" runat="server" Width="250px" Height="130px" CssClass="modalPopup" style="display:none; border:solid 1px #05DB35">
                <div style="width:100%; height:100px">
                <table width="100%" cellspacing="0" cellpadding="2">
                    <tr>
                        <td colspan="2" style="background-color:#61A737; color:White"><b>INVENTORY</b></td>
                    </tr>
                    <tr>
                        <td style="padding-top:5px">
                            <img src="../../Images/questionMark.jpg"/>
                        </td>
                        <td>
                            No sales Return Format found<br />
                            Do you want to create Bill Format!<br />
                        </td>
                    </tr>
                </table>
                </div>
                <div style="width:100%; height:30px">
                    <table width="100%">
                        <tr>
                            <td style="width:50%; padding-right:3px" align="right">
                                <asp:HyperLink ID="hyperTranFormat" runat="server" NavigateUrl="~/Main/Inventory/TransFormat.aspx" CssClass="messageBox">OK</asp:HyperLink>
                            </td> 
                            <td>
                                <asp:HyperLink ID="hyperCancelFormat" runat="server" NavigateUrl="~/Welcome.aspx" CssClass="messageBox">CANCEL</asp:HyperLink>
                            </td>
                        </tr>
                    </table>
                </div>
           </asp:panel>
            <AjaxControl:ModalPopupExtender ID="modalFormatExtender" runat="server" TargetControlID="lnkModal" PopupControlID="panelFormatMessage" BackgroundCssClass="modalBackground"></AjaxControl:ModalPopupExtender>         
            <asp:Panel ID="panelCustMessage" runat="server" Width="250px" Height="130px" CssClass="modalPopup" style="display:none; border:solid 1px #05DB35">
                <div style="width:100%; height:100px">
                <table width="100%" cellspacing="0" cellpadding="2">
                    <tr>
                        <td colspan="2" style="background-color:#61A737; color:White"><b>INVENTORY</b></td>
                    </tr>
                    <tr>
                        <td style="padding-top:5px">
                            <img src="../../Images/questionMark.jpg"/>
                        </td>
                        <td>
                            No Sales Invoice Found! <br />
                        </td>
                    </tr>
                </table>
                </div>
                <div style="width:100%; height:30px">
                    <table width="100%">
                        <tr>
                            <td  align="center">
                                <asp:HyperLink ID="hyperCustMessage" runat="server" NavigateUrl="~/Welcome.aspx" CssClass="messageBox">OK</asp:HyperLink>
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
            <AjaxControl:ModalPopupExtender ID="modalCustExtender" runat="server" TargetControlID="lnkModal" PopupControlID="panelCustMessage" BackgroundCssClass="modalBackground"></AjaxControl:ModalPopupExtender>
         
            <div style="width:98%">
                     
            <table style="width:98%; text-align:center">
                <tr>
                    <td>
                        <asp:Button ID="btnSubmit" Text="Submit" runat="server" CssClass="button" OnClick="btnSubmit_Click" OnClientClick="return Validation();" /> &nbsp;
                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CssClass="button" /> 
                    </td>
                </tr>
            </table> 
            <asp:Button ID="btnCreateItem" OnClick="btnCreateItem_Click" runat="server" Text="Create" style="display:none"  />
            
            </div>
        </asp:Panel>
        </div>
    </form>
         <script type="text/javascript">
             $(document).ready(function () {

                 $('.tabs a').click(function () {
                     switch_tabs($(this));
                 });

                 switch_tabs($('.defaulttab'));

             });

             function switch_tabs(obj) {
                 $('.tab-content').hide();
                 $('.tabs a').removeClass("selected");
                 var id = obj.attr("rel");

                 $('#' + id).show();
                 obj.addClass("selected");
             }
    </script>

   
</body>
</html>
